<?php
require_once '../../global.inc.php';

//SESSION中取出用户资料信息
$userInfo		= $_SESSION["userInfo"];
$codeRole		= $_SESSION["codeRole"];
//释放不需要的SESSION资源
//unset($_SESSION["userInfo"]);
//unset($_SESSION["codeRole"]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../user/js/checkForm.js"></script>
<title>无标题文档</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
.STYLE1  {color: #e1e2e3; font-size: 12px;}
.STYLE6  {color: #000000; font-size: 12px;}
.STYLE10 {color: #000000; font-size: 12px;}
.STYLE19 {color: #344b50; font-size: 12px;}
.STYLE21 {color: #3b6375; font-size: 12px;}
.STYLE22 {color: #295568; font-size: 12px;}
-->
</style>
</head>

<body>
<div align="center"><h3>修改用户资料</h3></div>
<form action="../../action/userAction.php?op=edit&id=<?php echo $userInfo['user_id']?>" method="post" onsubmit="return editFormSubmit()">
    <div align="center">
        <table width="250" border="0" cellpadding="3" cellspacing="1" bgcolor="#a8c7ce">
              <tr>
                <td width="35%" bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">用户名：</span><font color="red">*</font></div></td>
                <td bgcolor="#FFFFFF" class="STYLE6"><div align="center"><input readonly="readonly" type="text" id = "username" name="username" value="<?php echo $userInfo['user_name']?>"/></div></td>
              </tr>
              <tr>
                <td bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">电话号码：</span><font color="red">*</font></div></td>
                <td bgcolor="#FFFFFF" class="STYLE6"><div align="center"><input type="text" id = "mobile" name="mobile" value="<?php echo $userInfo['mobile']?>"/></div></td>
              </tr>
              <tr>
                <td bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">Email：</span><font color="red">*</font></div></td>
                <td bgcolor="#FFFFFF" class="STYLE6"><div align="center"><input type="text" id = "email" name="email" value="<?php echo $userInfo['email']?>"/></div></td>
              </tr>
              <?php if($role==1){//操作员权限为系统管理员才显示该下拉菜单
              	$userRole = $userInfo['role'];//获取要修改的用户的角色
              	echo "<tr><td bgcolor='d3eaef' class='STYLE6'><div align='left'><span class='STYLE10'>用户角色：</span><font color='red'>*</font></div></td>";
                echo "<td bgcolor='#FFFFFF' class='STYLE6'><div align='center'>";
                echo "<select style='width:155px' name='role' id='role'>";
                foreach ($codeRole as $codeRoleRow) {
					$roleCode 	= $codeRoleRow["role"];
					$roleName	= $codeRoleRow["role_name"];
					if($roleCode == $userInfo['role']){
                		echo "<option value='$roleCode' selected='selected'>$roleName</option>";
					}else{
						echo "<option value='$roleCode'>$roleName</option>";
					}
                }
                echo "</select></div></td></tr>";
              }?>
              <tr>
                <td bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">备注：</span></div></td>
                <td bgcolor="#FFFFFF" class="STYLE6"><div align="center"><input type="text" id = "comment" name="comment" value="<?php echo $userInfo['comment']?>"/></div></td>
              </tr>
              <tr>
                <td colspan="2" bgcolor="#FFFFFF" class="STYLE6">
                	<div align="center">
                    	<input type="submit" name="submit" value="提交"/>
                    </div>
                </td>
              </tr>
        </table>
</form>
</body>
</html>
